package com.shop.front.dao.user;


import com.shop.jpa.BaseSQLDao;
import com.shop.jpa.support.QuerySQL;
import com.shop.front.vo.user.UserExtractVo;
import com.shop.web.context.WebContext;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Repository;

@Repository
public class UserExtractSQLDao extends BaseSQLDao {

    public Page<UserExtractVo> pageExtract(Long userId) {
        StringBuffer field = new StringBuffer("ue.*");
        String from = "t_user_extract ue";
        String order = "ue.id desc";
        QuerySQL qs = new QuerySQL(WebContext.getPageNo(), WebContext.getPageSize(), field.toString(), from, order);
        qs.addWhereWithoutParams("ue.is_deleted = 0");
        qs.addWhereEq("ue.user_id", userId);
        return this.page(qs, UserExtractVo.class);
    }
}
